# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Container.V1.Model.IPAllocationPolicy do
  @moduledoc """
  Configuration for controlling how IPs are allocated in the cluster.

  ## Attributes

  *   `additionalPodRangesConfig` (*type:* `GoogleApi.Container.V1.Model.AdditionalPodRangesConfig.t`, *default:* `nil`) - Output only. The additional pod ranges that are added to the cluster. These pod ranges can be used by new node pools to allocate pod IPs automatically. Once the range is removed it will not show up in IPAllocationPolicy.
  *   `clusterIpv4Cidr` (*type:* `String.t`, *default:* `nil`) - This field is deprecated, use cluster_ipv4_cidr_block.
  *   `clusterIpv4CidrBlock` (*type:* `String.t`, *default:* `nil`) - The IP address range for the cluster pod IPs. If this field is set, then `cluster.cluster_ipv4_cidr` must be left blank. This field is only applicable when `use_ip_aliases` is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range to use.
  *   `clusterSecondaryRangeName` (*type:* `String.t`, *default:* `nil`) - The name of the secondary range to be used for the cluster CIDR block. The secondary range will be used for pod IP addresses. This must be an existing secondary range associated with the cluster subnetwork. This field is only applicable with use_ip_aliases is true and create_subnetwork is false.
  *   `createSubnetwork` (*type:* `boolean()`, *default:* `nil`) - Whether a new subnetwork will be created automatically for the cluster. This field is only applicable when `use_ip_aliases` is true.
  *   `defaultPodIpv4RangeUtilization` (*type:* `float()`, *default:* `nil`) - Output only. The utilization of the cluster default IPv4 range for the pod. The ratio is Usage/[Total number of IPs in the secondary range], Usage=numNodes*numZones*podIPsPerNode.
  *   `ipv6AccessType` (*type:* `String.t`, *default:* `nil`) - The ipv6 access type (internal or external) when create_subnetwork is true
  *   `nodeIpv4Cidr` (*type:* `String.t`, *default:* `nil`) - This field is deprecated, use node_ipv4_cidr_block.
  *   `nodeIpv4CidrBlock` (*type:* `String.t`, *default:* `nil`) - The IP address range of the instance IPs in this cluster. This is applicable only if `create_subnetwork` is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range to use.
  *   `podCidrOverprovisionConfig` (*type:* `GoogleApi.Container.V1.Model.PodCIDROverprovisionConfig.t`, *default:* `nil`) - [PRIVATE FIELD] Pod CIDR size overprovisioning config for the cluster. Pod CIDR size per node depends on max_pods_per_node. By default, the value of max_pods_per_node is doubled and then rounded off to next power of 2 to get the size of pod CIDR block per node. Example: max_pods_per_node of 30 would result in 64 IPs (/26). This config can disable the doubling of IPs (we still round off to next power of 2) Example: max_pods_per_node of 30 will result in 32 IPs (/27) when overprovisioning is disabled.
  *   `servicesIpv4Cidr` (*type:* `String.t`, *default:* `nil`) - This field is deprecated, use services_ipv4_cidr_block.
  *   `servicesIpv4CidrBlock` (*type:* `String.t`, *default:* `nil`) - The IP address range of the services IPs in this cluster. If blank, a range will be automatically chosen with the default size. This field is only applicable when `use_ip_aliases` is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range to use.
  *   `servicesIpv6CidrBlock` (*type:* `String.t`, *default:* `nil`) - Output only. The services IPv6 CIDR block for the cluster.
  *   `servicesSecondaryRangeName` (*type:* `String.t`, *default:* `nil`) - The name of the secondary range to be used as for the services CIDR block. The secondary range will be used for service ClusterIPs. This must be an existing secondary range associated with the cluster subnetwork. This field is only applicable with use_ip_aliases is true and create_subnetwork is false.
  *   `stackType` (*type:* `String.t`, *default:* `nil`) - The IP stack type of the cluster
  *   `subnetIpv6CidrBlock` (*type:* `String.t`, *default:* `nil`) - Output only. The subnet's IPv6 CIDR block used by nodes and pods.
  *   `subnetworkName` (*type:* `String.t`, *default:* `nil`) - A custom subnetwork name to be used if `create_subnetwork` is true. If this field is empty, then an automatic name will be chosen for the new subnetwork.
  *   `tpuIpv4CidrBlock` (*type:* `String.t`, *default:* `nil`) - The IP address range of the Cloud TPUs in this cluster. If unspecified, a range will be automatically chosen with the default size. This field is only applicable when `use_ip_aliases` is true. If unspecified, the range will use the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range to use. This field is deprecated due to the deprecation of 2VM TPU. The end of life date for 2VM TPU is 2025-04-25.
  *   `useIpAliases` (*type:* `boolean()`, *default:* `nil`) - Whether alias IPs will be used for pod IPs in the cluster. This is used in conjunction with use_routes. It cannot be true if use_routes is true. If both use_ip_aliases and use_routes are false, then the server picks the default IP allocation mode
  *   `useRoutes` (*type:* `boolean()`, *default:* `nil`) - Whether routes will be used for pod IPs in the cluster. This is used in conjunction with use_ip_aliases. It cannot be true if use_ip_aliases is true. If both use_ip_aliases and use_routes are false, then the server picks the default IP allocation mode
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :additionalPodRangesConfig =>
            GoogleApi.Container.V1.Model.AdditionalPodRangesConfig.t() | nil,
          :clusterIpv4Cidr => String.t() | nil,
          :clusterIpv4CidrBlock => String.t() | nil,
          :clusterSecondaryRangeName => String.t() | nil,
          :createSubnetwork => boolean() | nil,
          :defaultPodIpv4RangeUtilization => float() | nil,
          :ipv6AccessType => String.t() | nil,
          :nodeIpv4Cidr => String.t() | nil,
          :nodeIpv4CidrBlock => String.t() | nil,
          :podCidrOverprovisionConfig =>
            GoogleApi.Container.V1.Model.PodCIDROverprovisionConfig.t() | nil,
          :servicesIpv4Cidr => String.t() | nil,
          :servicesIpv4CidrBlock => String.t() | nil,
          :servicesIpv6CidrBlock => String.t() | nil,
          :servicesSecondaryRangeName => String.t() | nil,
          :stackType => String.t() | nil,
          :subnetIpv6CidrBlock => String.t() | nil,
          :subnetworkName => String.t() | nil,
          :tpuIpv4CidrBlock => String.t() | nil,
          :useIpAliases => boolean() | nil,
          :useRoutes => boolean() | nil
        }

  field(:additionalPodRangesConfig, as: GoogleApi.Container.V1.Model.AdditionalPodRangesConfig)
  field(:clusterIpv4Cidr)
  field(:clusterIpv4CidrBlock)
  field(:clusterSecondaryRangeName)
  field(:createSubnetwork)
  field(:defaultPodIpv4RangeUtilization)
  field(:ipv6AccessType)
  field(:nodeIpv4Cidr)
  field(:nodeIpv4CidrBlock)
  field(:podCidrOverprovisionConfig, as: GoogleApi.Container.V1.Model.PodCIDROverprovisionConfig)
  field(:servicesIpv4Cidr)
  field(:servicesIpv4CidrBlock)
  field(:servicesIpv6CidrBlock)
  field(:servicesSecondaryRangeName)
  field(:stackType)
  field(:subnetIpv6CidrBlock)
  field(:subnetworkName)
  field(:tpuIpv4CidrBlock)
  field(:useIpAliases)
  field(:useRoutes)
end

defimpl Poison.Decoder, for: GoogleApi.Container.V1.Model.IPAllocationPolicy do
  def decode(value, options) do
    GoogleApi.Container.V1.Model.IPAllocationPolicy.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Container.V1.Model.IPAllocationPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
